package com.scetop.banking;

public class SavingAccount extends Account {
    private double interestRate;

    // 构造器，接受余额和利率作为参数
    public SavingAccount(double init_balance, double interestRate) {
        super(init_balance); // 调用父类的构造器，传递余额
        this.interestRate = interestRate; // 初始化利率
    }

    // 获取利率
    public double getInterestRate() {
        return interestRate;
    }

    // 设置利率
    public void setInterestRate(double interestRate) {
        this.interestRate = interestRate;
    }

    // 覆盖父类的toString方法，提供更详细的账户信息
    @Override
    public String toString() {
        return "SavingAccount{" +
                "balance=" + getBalance() +
                ", interestRate=" + interestRate +
                '}';
    }
}